﻿namespace LiteBlog.Infrastructure.Constraints
{
    using System.Web;
    using System.Web.Routing;
    using System.Linq;
 
    public class ControllerConstraint : IRouteConstraint
    {
        public bool Match(
            HttpContextBase httpContext, 
            Route route, 
            string parameterName, 
            RouteValueDictionary values, 
            RouteDirection routeDirection)
        {
            var controllerName = values["controller"];
            var validNames = new string[] { "Admin", "Archive", "Author", "Category", "Comment", "Home", "Page", "Post", "Scheduler", "Tag"};
            return validNames.Contains(controllerName);
        }
    }
}